package main.java.products;

import java.io.Serializable;
import java.util.Date;

import org.apache.log4j.Level;

import main.java.feeding.FeedManager;

public class FinancialProduct implements Serializable{
	
private double bid;
private double ask;
private double mid;
private String devise;
	
private String code;
private Date maturity;
private String juridiction;
	
	
public FinancialProduct(double bid, double ask, String devise, String code,
Date maturity, String juridiction) {
super();
this.bid = bid;
this.ask = ask;
this.mid = (ask+bid)/2;

if (devise.length()==3) {
	this.devise = devise;
} else { 
	FeedManager.getLogger().log(Level.WARN, "Transcation : devise ne fait pas 3 lettres");
	// TO DO : 
}

this.code = code;
this.maturity = maturity;
this.juridiction = juridiction;
}

public static int mid(int bid, int ask) {
	return (bid+ask)/2;
}

public double getBid() {
return bid;
}


public void setBid(double bid) {
this.bid = bid;
}


public double getAsk() {
return ask;
}


public void setAsk(double ask) {
this.ask = ask;
}


public double getMid() {
return mid;
}


public void setMid(double mid) {
this.mid = mid;
}


public String getDevise() {
return devise;
}


public void setDevise(String devise) {
this.devise = devise;
}


public String getCode() {
return code;
}


public void setCode(String code) {
this.code = code;
}


public Date getMaturity() {
return maturity;
}


public void setMaturity(Date maturity) {
this.maturity = maturity;
}


public String getJuridiction() {
return juridiction;
}


public void setJuridiction(String juridiction) {
this.juridiction = juridiction;
}
}
